<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>errorCaptured</title>
    </head>
    <body>

        <div id="root">
            <counter></counter>
        </div>

        <script src="../scripts/vue@3.2.31.js"></script>

        <script>
            const options = {
                components: {
                    'counter': {
                        template: `<button>123</button>`,
                        // 生命周期钩子
                        mounted(){
                            throw new Error('主动抛出的异常');
                        }
                    }
                },
                // 生命周期钩子
                errorCaptured(err,comp,info){
                    console.log( '- - - error captured - - -' );
                    console.log( '\t' , err );
                    console.log( '\t' , comp );
                    console.log( '\t' , info );
                }
            }
            Vue.createApp(options).mount('#root');
        </script>
        
    </body>
</html>